export default{
	cartLength(state) {
		return state.cartList.length
	},
	cartList(state) {
		return state.cartList
	},
	//计算总价格
	totalPrice(state) {
	  const cartList = state.cartList;
	  return '￥' + cartList.filter(item => {
	    return item.checked
	  }).reduce((preValue, item) => {
	    return preValue + item.count * item.price
	  }, 0).toFixed(2)
	},
	//去计算
	totalCount(state){
		const cartList = state.cartList;
		return  cartList.filter(item => {
			return item.checked
			}).reduce((preValue, item) => {
				return preValue + item.count
			}, 0)
		
	}
}